package com.baimawangzi.recovery.servlet.user;

import com.baimawangzi.recovery.bean.User;
import com.baimawangzi.recovery.service.impl.UserServiveImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/userfindbyid.do")
public class UserFindByIdServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        UserServiveImpl userServive = new UserServiveImpl();
        //解析url参数
        int id = Integer.parseInt(req.getParameter("id"));
        User user = userServive.findById(id);
        req.setAttribute("user",user);
        req.getRequestDispatcher("user_update.jsp").forward(req,resp);

    }
}
